$(window).scroll(function () {
    var top = $(window).scrollTop();
    if (top < 99) {
        $('#navbar1').removeClass("shadow");
        $('#navbar1').css("position", "relative");
        $('#navbar1').css("top", "0px");
    } else {
        $('#navbar1').addClass('shadow');
        $('#navbar1').css("position", "fixed");
    }
});

$('#gotop').click(function () {
    $('html,body').animate({scrollTop: 0}, 'slow');
});

function siteTime() {
    window.setTimeout("siteTime()", 1000);
    var seconds = 1000;
    var minutes = seconds * 60;
    var hours = minutes * 60;
    var days = hours * 24;

    var today = new Date();
    var todayYear = today.getFullYear();
    var todayMonth = today.getMonth();
    var todayDate = today.getDate();

    var t1 = Date.UTC(2016, 7, 8);
    var t2 = Date.UTC(todayYear, todayMonth, todayDate);
    var diff = t2 - t1;

    var diffDays = Math.floor(diff / days);
    document.getElementById("sitetime").innerHTML = diffDays + " 天 ";
}